\(\int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx\) [1068]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 47 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\frac {(c-i d) x}{2 a}+\frac {i c-d}{2 f (a+i a \tan (e+f x))} \]

[Out]

1/2*(c-I*d)*x/a+1/2*(I*c-d)/f/(a+I*a*tan(f*x+e))

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {3607, 8} \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\frac {-d+i c}{2 f (a+i a \tan (e+f x))}+\frac {x (c-i d)}{2 a} \]

[In]

Int[(c + d*Tan[e + f*x])/(a + I*a*Tan[e + f*x]),x]

[Out]

((c - I*d)*x)/(2*a) + (I*c - d)/(2*f*(a + I*a*Tan[e + f*x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3607

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*((a + b*Tan[e + f*x])^m/(2*a*f*m)), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {i c-d}{2 f (a+i a \tan (e+f x))}+\frac {(c-i d) \int 1 \, dx}{2 a} \\ & = \frac {(c-i d) x}{2 a}+\frac {i c-d}{2 f (a+i a \tan (e+f x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.32 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.19 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\frac {(c-i d) \arctan (\tan (e+f x))}{2 a f}-\frac {c+i d}{2 a f (i-\tan (e+f x))} \]

[In]

Integrate[(c + d*Tan[e + f*x])/(a + I*a*Tan[e + f*x]),x]

[Out]

((c - I*d)*ArcTan[Tan[e + f*x]])/(2*a*f) - (c + I*d)/(2*a*f*(I - Tan[e + f*x]))

Maple [A] (verified)

Time = 0.30 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.15

method result size
risch \(-\frac {i x d}{2 a}+\frac {x c}{2 a}-\frac {{\mathrm e}^{-2 i \left (f x +e \right )} d}{4 a f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c}{4 a f}\) \(54\)
derivativedivides \(-\frac {i d \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) c}{2 f a}+\frac {c}{2 f a \left (\tan \left (f x +e \right )-i\right )}+\frac {i d}{2 f a \left (\tan \left (f x +e \right )-i\right )}\) \(76\)
default \(-\frac {i d \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) c}{2 f a}+\frac {c}{2 f a \left (\tan \left (f x +e \right )-i\right )}+\frac {i d}{2 f a \left (\tan \left (f x +e \right )-i\right )}\) \(76\)
norman \(\frac {\frac {\left (-i d +c \right ) x}{2 a}-\frac {-i c +d}{2 a f}+\frac {\left (i d +c \right ) \tan \left (f x +e \right )}{2 a f}+\frac {\left (-i d +c \right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{2 a}}{1+\tan ^{2}\left (f x +e \right )}\) \(81\)

[In]

int((c+d*tan(f*x+e))/(a+I*a*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

-1/2*I*x/a*d+1/2*x/a*c-1/4/a/f*exp(-2*I*(f*x+e))*d+1/4*I/a/f*exp(-2*I*(f*x+e))*c

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.89 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\frac {{\left (2 \, {\left (c - i \, d\right )} f x e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{4 \, a f} \]

[In]

integrate((c+d*tan(f*x+e))/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/4*(2*(c - I*d)*f*x*e^(2*I*f*x + 2*I*e) + I*c - d)*e^(-2*I*f*x - 2*I*e)/(a*f)

Sympy [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.85 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\begin {cases} \frac {\left (i c - d\right ) e^{- 2 i e} e^{- 2 i f x}}{4 a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {c - i d}{2 a} + \frac {\left (c e^{2 i e} + c - i d e^{2 i e} + i d\right ) e^{- 2 i e}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {x \left (c - i d\right )}{2 a} \]

[In]

integrate((c+d*tan(f*x+e))/(a+I*a*tan(f*x+e)),x)

[Out]

Piecewise(((I*c - d)*exp(-2*I*e)*exp(-2*I*f*x)/(4*a*f), Ne(a*f*exp(2*I*e), 0)), (x*(-(c - I*d)/(2*a) + (c*exp(
2*I*e) + c - I*d*exp(2*I*e) + I*d)*exp(-2*I*e)/(2*a)), True)) + x*(c - I*d)/(2*a)

Maxima [F(-2)]

Exception generated. \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((c+d*tan(f*x+e))/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 83 vs. \(2 (35) = 70\).

Time = 0.36 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.77 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=-\frac {\frac {{\left (-i \, c - d\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a} + \frac {{\left (i \, c + d\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a} + \frac {-i \, c \tan \left (f x + e\right ) - d \tan \left (f x + e\right ) - 3 \, c - i \, d}{a {\left (\tan \left (f x + e\right ) - i\right )}}}{4 \, f} \]

[In]

integrate((c+d*tan(f*x+e))/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

-1/4*((-I*c - d)*log(tan(f*x + e) + I)/a + (I*c + d)*log(tan(f*x + e) - I)/a + (-I*c*tan(f*x + e) - d*tan(f*x
+ e) - 3*c - I*d)/(a*(tan(f*x + e) - I)))/f

Mupad [B] (verification not implemented)

Time = 5.77 (sec) , antiderivative size = 45, normalized size of antiderivative = 0.96 \[ \int \frac {c+d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx=-\frac {x\,\left (d+c\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a}+\frac {-\frac {d}{2\,a}+\frac {c\,1{}\mathrm {i}}{2\,a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )} \]

[In]

int((c + d*tan(e + f*x))/(a + a*tan(e + f*x)*1i),x)

[Out]

((c*1i)/(2*a) - d/(2*a))/(f*(tan(e + f*x)*1i + 1)) - (x*(c*1i + d)*1i)/(2*a)